//
//  ContentTableViewCell.m
//  B段项目
//
//  Created by 徐茂怀 on 15/11/5.
//  Copyright © 2015年 徐茂怀. All rights reserved.
//

#import "ContentTableViewCell.h"
#import "FitHeader.h"
@implementation ContentTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}
-(void)createView
{
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.backgroundColor = [UIColor whiteColor];
    _titleLabel.font = [UIFont systemFontOfSize:25 * FitWidth];
    _titleLabel.textColor = [UIColor colorWithRed:0.12 green:0.63 blue:0.59 alpha:1];
    _contentLabel = [[UILabel alloc]init];
    _contentLabel.font = [UIFont systemFontOfSize:15 * FitWidth];
    _contentLabel.numberOfLines = 0;
    _contentLabel.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_titleLabel];
    [self.contentView addSubview:_contentLabel];
}
-(void)setContentString:(NSString *)contentString
{
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:15 * FitWidth],NSFontAttributeName, nil];
    CGRect rect = [contentString boundingRectWithSize:CGSizeMake(355 * FitWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    _contentLabel.text = contentString;
    _contentLabel.frame = CGRectMake(10 * FitWidth, 50 * FitHeight , 355 * FitWidth, rect.size.height);
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    _titleLabel.frame = CGRectMake(10 * FitWidth, 10 * FitHeight, 300 * FitWidth, 30 * FitHeight);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
